import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.net.UnknownHostException;

import static java.net.InetAddress.*;

public class FireFoxDriver {

    public static WebDriver driver;

    public static WebDriver createFireFoxDriver(){

        driver = new FirefoxDriver();

        //Automatically will get the computers IP address and load the local tacks application

        try {
            driver.get("http://" + getLocalHost().getHostAddress() + "/tracks/login");
        } catch (UnknownHostException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

        return driver;
    }

    public static WebDriver createChromeDriver(){

        System.setProperty("webdriver.chrome.driver", "C:/Users/Administrator/Documents/NovusProject/chromedriver.exe");

        DesiredCapabilities capabilities = DesiredCapabilities.chrome();
        capabilities.setCapability("chrome.binary","C:/Program Files/Google/Chrome/Application/chrome.exe");

        driver = new ChromeDriver(capabilities);
        try {
            driver.get("http://" + getLocalHost().getHostAddress() + "/tracks/login");
        } catch (UnknownHostException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

        return driver;
    }
}
